package uk.co.agileworks.bidpirate.web;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import uk.co.agileworks.bidpirate.service.BusinessFacade;
import uk.co.agileworks.bidpirate.service.EbayFacade;

@Component
public class BaseController {

	protected static final Logger LOGGER = LoggerFactory.getLogger(BaseController.class);

	@Autowired
	protected BusinessFacade businessFacade;

	@Autowired
	protected EbayFacade ebayFacade;

	@Autowired
	protected UserSession userSession;

	@Resource
	private String openItemUrl;

	public String getOpenItemUrl() {
		return openItemUrl.replaceFirst("%EBAY_HOME%", userSession.getUser().getRegion()
				.getEbayHome());
	}

}
